package com.hoshiibuy.global.entity.param;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hoshiibuy.common.query.CommonParam;
import com.hoshiibuy.global.entity.SysProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>
 * 查询属性参数
 * </p>
 *
 * @author campchen
 * @since 2019-04-27
 */
@Data
@ApiModel(value = "查询属性", description = "查询属性")
public class SysPropertiesQueryParam extends CommonParam {


    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID")
    private Long id;

    /**
     * 平台ID
     */
    @ApiModelProperty(value = "平台ID")
    private Long platid;

    /**
     * 属性名称
     */
    @ApiModelProperty(value = "属性名称")
    private String name;

    /**
     * 属性类别
     */
    @ApiModelProperty(value = "属性类别",example = "1")
    private Integer fieldtype;

    /**
     * 内容长度
     */
    @ApiModelProperty(value = "内容长度")
    private Long fieldlen;

    /**
     * 是否是必须值
     */
    @ApiModelProperty(value = "是否是必须值",example = "1")
    private Integer required;

    /**
     * 标志
     */
    @ApiModelProperty(value = "标志")
    private String tag;

    /**
     * 是否可用0-不可用 1-可用
     */
    @ApiModelProperty(value = "是否可用0-不可用 1-可用 系统自动传递1", required = true,example = "1")
    private Integer enabled;

    public QueryWrapper<SysProperties> getQueryWrapper() {
        QueryWrapper<SysProperties> queryWrapper = new QueryWrapper<SysProperties>();
        queryWrapper.eq(this.id != null, "id", this.id);
        queryWrapper.eq(this.platid != null, "platid", this.platid);
        queryWrapper.eq(StringUtils.isNotBlank(this.name), "name", this.name);
        queryWrapper.eq(this.fieldtype != null, "fieldtype", this.fieldtype);
        queryWrapper.eq(this.fieldlen != null, "fieldlen", this.fieldlen);
        queryWrapper.eq(this.required != null, "required", this.required);
        queryWrapper.eq(StringUtils.isNotBlank(this.tag), "tag", this.tag);
        queryWrapper.eq(this.enabled != null, "enabled", this.enabled);
        return queryWrapper;
    }
}
